<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<TITLE>修改客户拜访信息</TITLE> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="css/Style.css" type=text/css rel=stylesheet>
<link href="css/Manage.css" type=text/css
	rel=stylesheet>
<script type="text/javascript" src="js/jquery-3.5.0.min.js"></script>

<meta content="mshtml 6.00.2900.3492" name=generator>
</head>
<body>
	<form id=form1 name=form1
		action="visit"
		method="get">
		<input type="hidden" name="visitId" value="${visit.visit_id }"/>
		<input type="hidden" name="flag" value="edit"/>
		<table cellspacing=0 cellpadding=0 width="98%" border=0>
			<tbody>
				<tr>
					<td width=15><img src="images/new_019.jpg"
						border=0></td>
					<td width="100%" background="images/new_020.jpg"
						 height=20></td>
					<td width=15><img src="images/new_021.jpg"
						border=0></td>
				</tr>
			</tbody>
		</table>
		<table cellspacing=0 cellpadding=0 width="98%" border=0>
			<tbody>
				<tr>
					<td width=15 background="images/new_022.jpg"><img
						src="images/new_022.jpg" border=0></td>
					<td valign=top width="100%" bgcolor=#ffffff>
						<table cellspacing=0 cellpadding=5 width="100%" border=0>
							<tr>
								<td class=managehead>当前位置：客户拜访管理 &gt; 修改拜访列表</td>
							</tr>
							<tr>
								<td height=2></td>
							</tr>
						</table>
						<table cellspacing=0 cellpadding=5  border=0>
					<tr>
								<td>所属客户：</td>
								<td>
									<input type="hidden" id="cust_id" value="${visit.visit_cust_id }">
									<select name="custId" id="custName">
										<c:forEach items="${customers }" var="customer">
											<option value="${customer.cust_id }">${customer.cust_name }</option>
										</c:forEach>
									</select>
								</td>
								<td>负责人：</td>
								<td>
									<input type="hidden" id="lkm_id" value="${visit.visit_user_id }">
									<select name="lkmId" id="lkmName">
										<c:choose>
										<c:when test="${not empty lkms}">
											<c:forEach items="${lkms }" var="lkm">
												<option value='${lkm.lkm_id }'>${lkm.lkm_name }</option>
											</c:forEach>
										</c:when>
										<c:otherwise>
											<option value='0'>暂无联系人</option>
										</c:otherwise>
									</c:choose>
									</select>
								</td>
							</tr>
							<tr>
								<td>拜访时间：</td>
								<td>
									<input type="date" name="time" value="${visit.visit_time }"/>
								</td>
								<td>下次拜访时间 ：</td>
								<td>
									<input type="date" name="nexttime" value="${visit.visit_nexttime }"/>
								</td>
							</tr>
							<tr>
								<td>被拜访人：</td>
								<td>
								<input class=textbox name="interviewee" id=sChannel2
														style="WIDTH: 180px" maxLength=50 value="${visit.visit_interviewee }" />
									
								</td>
								<td>拜访地点：</td>
								<td>
								<input class=textbox name="addr" id=sChannel2
														style="WIDTH: 180px" maxLength=50  value="${visit.visit_addr }"/>
								</td>
							</tr>
							<tr>
								<td>拜访详情 ：</td>
								<td>
								<input class=textbox name="detail" id=sChannel2
														style="WIDTH: 180px" maxLength=50 value="${visit.visit_detail }"/>
								</td>
								
							</tr>
							
							<tr>
								<td rowspan=2>
								<input class=button id=sButton2 type=submit
														value="保存 " name=sButton2>
								</td>
							</tr>
						</table>
						
						
					</td>
					<td width=15 background="images/new_023.jpg">
					<img src="images/new_023.jpg" border=0></td>
				</tr>
			</tbody>
		</table>
		<table cellspacing=0 cellpadding=0 width="98%" border=0>
			<tbody>
				<tr>
					<td width=15><img src="images/new_024.jpg"
						border=0></td>
					<td align=middle width="100%"
						background="images/new_025.jpg" height=15></td>
					<td width=15><img src="images/new_026.jpg"
						border=0></td>
				</tr>
			</tbody>
		</table>
	</form>
</body>
<script type="text/javascript">
	$("#custName").val($("#cust_id").val());
	
	$("#lkmName").val($("#lkm_id").val());
	
	$("#custName").change(function(){
		var custId = $("#custName").val();
		$.ajax({
			url:'visit',
			type:'post',
			data:{
				'flag':'queryLkm',
				'custId':custId
			},
			dataType:'json',
			success:function(ret){
				if(ret!=null && ret!=""){
					$("#lkmName").html("");
					for(var i=0;i<ret.length;i++){
						$("#lkmName").append("<option value='"+ret[i].lkm_id+"'>"+ret[i].lkm_name+"</option>");
					}
				}else{
					$("#lkmName").html("");
					$("#lkmName").append("<option value='0'>暂无联系人</option>");
				}
			}
		})
	})
</script>
</html>
